package com.his.his_system.controller.VisitController;

import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.his.his_system.common.util.ResultAdvice;
import com.his.his_system.controller.VisitController.DefaultBean.ChangeJsonAndObject;
import com.his.his_system.controller.VisitController.DefaultBean.ExecutionScheduling;
import com.his.his_system.controller.VisitController.DefaultBean.Obj;
import com.his.his_system.controller.VisitController.DefaultBean.PaiBan;
import com.his.his_system.domain.Doctorscheduling;
import com.his.his_system.domain.DzmHisAuthGroup;
import com.his.his_system.domain.DzmHisDefault;
import com.his.his_system.domain.DzmHisDepartment;
import com.his.his_system.service.DefaultService;
import com.his.his_system.service.DzmHisDepartmentService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 医生排班
 * @author 余襄元
 */
@RestController
@RequestMapping("/his/sad/doctorscheduling/")
public class DoctorschedulingController {


    @Resource
    private DefaultService defaultService;

    @Resource
    private DzmHisDepartmentService dzmHisDepartmentService;

    /**
     * 获取所有排班
     * @return
     */
    @GetMapping("getAllScheduling")
    public ResultAdvice<List<Doctorscheduling>> getAllScheduling(String name,Integer ks ,String date){
        return ResultAdvice.success(defaultService.getAllScheduling(name,ks,date),"成功");
    }


    /**
     * 获取医生列表附带职务 弃用
     */
    @GetMapping("getAllDepartment")
    public ResultAdvice<List<DzmHisDepartment>> getAllDepartment(){
        return ResultAdvice.success(dzmHisDepartmentService.list(),"成功");
    }

    /**
     * 科室获取医生列表
     * @param
     * @return
     */
    @GetMapping("getAllDoctorAndDep")
    public ResultAdvice getAllDoctorbydepid(){
        return ResultAdvice.success(defaultService.getAllDoctorbydepid(),"成功");
    }

    /**
     * 获取所有科室
     * @return
     *
     */
    @GetMapping("getAllDep")
    public ResultAdvice getAllDep(){
        return ResultAdvice.success(dzmHisDepartmentService.list(),"成功");
    }

    @PostMapping("Scheduling")
    public ResultAdvice Scheduling(@RequestBody Obj obj){
      return ResultAdvice.success(defaultService.Scheduling(obj.getDatastr()));
    }
}
